package cn.gailvlun.gll.presentation.splash

import cn.gailvlun.gll.net.base.Profile


enum class LoginStateEnum {
    
    NONE,
    
    THIRD_PARTY_AUTHED_NO_BOUND,
    
    MOBILE_BOUND,
    
    ACTIVITED;

    companion object {
        @JvmStatic
        fun getState(profile: Profile?): LoginStateEnum {
            if (profile == null) {
                return LoginStateEnum.NONE
            } else {
                val uid = profile.uid
                val activated = profile.isActivated
                val mobile_bound = profile.is_mobile_bound

                if (uid != null && !mobile_bound) { 
                    return LoginStateEnum.THIRD_PARTY_AUTHED_NO_BOUND
                } else if (mobile_bound && !activated) {
                    return LoginStateEnum.MOBILE_BOUND
                } else if (mobile_bound && activated) {
                    return LoginStateEnum.ACTIVITED
                }

                return LoginStateEnum.NONE
            }


        }
    }
}